﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace XML
{
    class xmlTest
    {
        static void Main(string[] args)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load("..\\..\\catalogue .xml");
            XmlNode rootNode = doc.DocumentElement;
            Dictionary<string, int> autors = new Dictionary<string, int>();
            XmlNodeList albums = rootNode.ChildNodes;
            foreach (XmlNode album in albums)
            {
                if (autors.ContainsKey(album["artist"].InnerText))
                {
                    autors[album["artist"].InnerText]++;
                }
                else
                {
                    autors.Add(album["artist"].InnerText, 1);
                }
            }
            foreach (var item in autors)
            {
                Console.WriteLine("Artist: {0} albums :{1}", item.Key , item.Value);
            }
        }
    }
}
